package com.example.demo.config;

import com.example.demo.message.Receiver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


import java.util.concurrent.CountDownLatch;

/**
 * Created by jinmingjiang on 2017/9/18.
 */
@Configuration
public class RedisMessageConfig {

//    @Bean
//    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter){
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(connectionFactory);
//        container.addMessageListener(listenerAdapter,new PatternTopic("chat"));
//        return container;
//    }
//
//    @Bean
//    MessageListenerAdapter listenerAdapter(Receiver receiver){
//        return new MessageListenerAdapter(receiver,"receiveMessage");
//    }
//
//    @Bean
//    Receiver receiver(CountDownLatch latch){
//        return new Receiver(latch);
//    }
//
//    @Bean
//    CountDownLatch latch(){
//        return new CountDownLatch(1);
//    }
}
